<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>实现0.5px</title>
  <style>
    div::before {
      content: "";
      display: block; /* 方便设置宽高 */
      /* margin-bottom: 50px; */
      height: 1px;
      background-color: red;
      transform: scale(0.5);  /* 缩放0.5倍 */
      position: absolute;
      left: -50%;
      width: 200%;
    }
  </style>
</head>
<body>
  <div>这是条直线</div>
</body>
</html>